<?php

  $allowed_page = true;

  function __autoload($className) {
    if (!isset($allowed_page)) { $allowed_page = true; }
	require_once("lib/config.php");
	require_once(CLASS_PATH."{$className}.class.php");
  }
  
  if (isset($_POST['username'])) {
     if (isset($_POST['passwd']) && $_POST['passwd'] == $_POST['re_passwd']) {
        //Retrieving fields.
        $user = addslashes($_POST['username']);
        $pwd = addslashes($_POST['passwd']);
        $email = addslashes($_POST['email']);
        $country = $_POST['location'];
        $player = new Player();
		$message=$player->register($user, $pwd, $email, $country);
	}
		
	else {
	  $message = "The passwords informed do not match";
	}
		
	if($message=="1"){
	  $message = "您的帐户已成功创建，请点 <a href=\"login.php\">这里</a> 登录"	;	
	}

			
			
		
        
	
      

  }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link type="text/css" rel="stylesheet" href="../css/portal.css">
  <title>D5Power WebGame Engine - 用户中心</title>
  
</script>
</head>


<body>

<div id="main_top">
</div>


<div id="container_principal">

  <div id="textura_lateral_esquerda">

	<!-- INÍCIO - Menu lateral -->
	<div class="menu">
	  <div class="menu_esquerda"></div>
	  <div class="menu_direita"></div>
	  <div class="menu_inferior"></div>
	  <div class="menu_superior"></div>

	  <p class="itens_menu">
	    <img border="0" src="../pictures/portal/menu_hover_icon.gif" align="top" width="16" height="17">
	    <b><a href="index.php">主页</a></b><br>

	    <img border="0" src="../pictures/portal/menu_line.gif" width="122" height="5"><br>
  
	    <img border="0" src="../pictures/portal/menu_hover_icon.gif" align="top" width="16" height="17">
	    <b><a href="login.php">登录</a></b><br>

	    <img border="0" src="../pictures/portal/menu_line.gif" width="122" height="5"><br>
  
	    <img border="0" src="../pictures/portal/menu_hover_icon.gif" align="top" width="16" height="17">
	    <b><a href="register.php">注册新帐户</a></b><br>
  
	    <img border="0" src="../pictures/portal/menu_line.gif" width="122" height="5"><br>
	  </p>
	</div>
	<!-- FIM - Menu lateral -->

    
    <div id="barra_lateral_esquerda">
    </div>

  </div>
  <!-- fim do quadro textura lateral -->
     

	<!-- Início do quadro main -->
    <div id="main">
    	
		<!-- INÍCIO - Quadro do formulário -->
		<div class="form_header">
			<p><img style="vertical-align: middle;" src="../pictures/portal/header_left.gif"> 帐户注册</p>
		</div>
		
		<div class="form_square">
		  <div class="lateral_esquerda"></div>
		  <div class="lateral_direita"></div>
		  <div class="linha_inferior"></div>
		  <div class="linha_superior"></div>
		  <div style="padding: 10px;">

	        <p style="text-align: center;">
			  <b>请填写以下内容注册新的帐户</b>
			</p>

        	<form method="POST" name="register" action="register.php">
	
              <p style="text-align: left; text-indent: 152px;">
              	用户名：
                <input size="20" maxlength="18" type="text" name="username" id="user" class="text">
			  </p>			
			  
              <p style="text-align: left; text-indent: 152px;">
              	密　码：
                <input size="20" maxlength="32" type="password" name="passwd" id="pwd" class="text">
			  </p>	

              <p style="text-align: left; text-indent: 152px;">
              	确　认：
                <input size ="20"　maxlength="32" type="password" name="re_passwd" id="re_pwd" class="text">
			  </p>	
			  
			  <p style="text-align: left; text-indent: 152px;">
              	E-mail：
                <input size="20"　maxlength="56" type="text" name="email" id="email" class="text">
			  </p>

			  <p style="text-align: center;">
			  	<input type="submit" value="注册新帐户" name="button" class="button">
			  </p>

              <p style="text-align: center;">
              	<font size="2" color="#ff1010">
              		<?php
                      if (isset($message)) {print($message);}
                    ?>
				</font>
			  </p>
			  
	        </form>

		  </div>
		  
		</div>
		<!-- FIM - Quadro de login -->  		
		
    </div>
	<!-- fim do quadro main -->


    <div id="textura_lateral_direita">
      <div id="barra_lateral_direita">
      </div>
    </div>
    
    
</div>

</body>

</html>